package com.copa.gamestore.module.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.copa.gamestore.module.user.domain.UserRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author copa
 * @createDate 2022-09-22 10:04
 * @function
 */
public interface UserRoleMapper extends BaseMapper<UserRole> {

    @Select("SELECT role_name FROM user_role ur LEFT JOIN role r ON ur.role_id = r.id WHERE ur.user_id = #{userId}")
    List<String> listRoleName(@Param("userId") Long userId);
}
